package erlwitch.parser;

import java.util.ArrayList;
import java.util.List;

import erlwitch.parser.structure.Function;
import erlwitch.parser.structure.Invocation;

public class ParserListener {

	private List<Function> funList = new ArrayList<Function>();
	private List<Invocation> invList = new ArrayList<Invocation>();
	private String atom = null;
	private String moduleName = null;
	
	public void clear() {
		invList = new ArrayList<Invocation>();
		atom = null;
	}
	
	public void variable(String v) {
		
	}
	
	public void macro(String m) {
	}

	public void atom(String a) {
		atom = a;
	}

	public void function() {
	}

	public void functionClause(String symbol) {
	}
	
	public void addInvocation(Invocation i) {
		invList.add(i);
	}

	public void newScope() {
		invList = new ArrayList<Invocation>();
	}

	public void addFunction(Function fun) {
		fun.setInvs(invList);
		funList.add(fun);
		newScope();
	}
	
	public void setModule() {
		moduleName = atom;
		clear();
	}

	public List<Function> getFunList() {
		return funList;
	}

	public String getModuleName() {
		return moduleName;
	}
	
}
